<!DOCTYPE html>
<html lang="">
<head>
    <meta charset="UTF-8"/>
    <title>${site_title}</title>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type"/>
    <meta content="width=device-width, initial-scale=1, maximum-scale=1" name="viewport"/>
    <meta content="IE=Edge" http-equiv="X-UA-Compatible"/>
    <link href="${site_icon}" rel="shortcut icon" type="image/x-icon"/>
    <link href="${cdn}/${pkg}/sdk/sdk.css" rel="stylesheet" title="default"/>
    <link href="${cdn}/${pkg}/sdk/helper.css" rel="stylesheet"/>
    <link href="${cdn}/${pkg}/sdk/iconfont.css" rel="stylesheet"/>
    ${theme_css}
    <script src="${cdn}/${pkg}/sdk/sdk.js"></script>
    <script src="${cdn}/vue@2.7.14/dist/vue.min.js"></script>
    <script src="${cdn}/history@5.3.0/umd/history.production.min.js"></script>
    <style>
        html, body,
        .app-wrapper {
            position: relative;
            width: 100%;
            height: 100%;
            margin: 0;
            padding: 0;
        }

        :root {
            --Page-main-bg: #ffffff;
            --colors-brand-main: #ce5050;
            --colors-brand-5: #ce5050;
            --colors-brand-4: #b84343;
            --colors-brand-6: #de5b5b;
            --Layout-asideLink-color: #ce5050;
            --colors-brand-10: rgba(206, 80, 80, 0.08)
            --Layout-nav-height: 2.8rem;
            --borders-radius-3: 10px;
            --Layout-aside-bg: rgba(0, 0, 0, 0);
            --sizes-size-7: 1rem;
        }

        .amis-scope .a-AppBcn {
            background-color: #FFFFFF;
        }

        /*
        .amis-scope .a-Layout--asideFixed .a-Layout-asideWrap  {
            box-shadow: 1px 8px 3px 2px rgba(26, 25, 23, 0.3);
        }
        */

        .amis-scope .a-Layout-brand, .amis-scope .a-Layout-brandBar, .amis-scope .a-Layout-aside {
            background-color: rgba(0, 0, 0, 0);
        }

        .amis-scope .a-AsideNav-list {
            background-color: #FFFFFF;
            border-radius: 8px; /* 圆角矩形，可根据需要调整数值 */
            color: #1a1917; /* 修改文字颜色，可根据需要调整颜色值 */
            border: 1px solid #ce5050;
        }

        .amis-scope .a-AsideNav-item {
            background-color: #FFFFFF;
            border-radius: 8px; /* 圆角矩形，可根据需要调整数值 */
            color: #1a1917; /* 修改文字颜色，可根据需要调整颜色值 */
        }

        .amis-scope .a-AsideNav-item:hover {
            background-color: #cfcfcf;
            color: #1a1917; /* 修改文字颜色，可根据需要调整颜色值 */
        }

        .amis-scope .a-AsideNav-itemLabel  {
            /* background-color: #cfcfcf; */
            color: #1a1917; /* 修改文字颜色，可根据需要调整颜色值 */
        }

        .amis-scope .a-AsideNav-item:hover > a >  .a-AsideNav-itemLabel {
            color: #FFFFFF;
        }

        .amis-scope .a-AsideNav-item.is-active > a {
            border-radius: 8px;
            background-color: #ce5050;
            color: #FFFFFF; /* 修改文字颜色，可根据需要调整颜色值 */
        }

        .amis-scope .a-ButtonToolbar {
            border-radius: 10px;
            background-color: #ce5050;
        }

        .amis-scope .a-AsideNav-item.is-active .a-AsideNav-item .a-AsideNav-itemLabel{
            color: #1a1917; /* 修改文字颜色，可根据需要调整颜色值 */
        }

        .amis-scope .a-AsideNav-item.is-open > .a-AsideNav-item:hover > .a-AsideNav-itemLabel{
            color: #FFFFFF; /* 修改文字颜色，可根据需要调整颜色值 */
        }

        .amis-scope .a-AsideNav-item:hover > a > .a-AsideNav-itemLabel {
            color: unset;
        }

        .amis-scope .a-AsideNav-item.is-active .a-AsideNav-itemLabel {
            color: #FFFFFF; /* 修改文字颜色，可根据需要调整颜色值 */
        }

        .amis-scope .a-AsideNav-item a {
            border-radius: 8px;
        }


        .a-AsideNav-item.is-open:has(.a-AsideNav-item.is-open.is-active) {
            background-color: transparent;
            color: #FFFFFF;
        }


        a-AsideNav-item.is-open > a > i {
            color: #FFFFFF;
        }

        a-AsideNav-item.is-open > a > a-AsideNav-itemLabel {
            color: #FFFFFF;
        }

        .amis-scope .a-AsideNav-item a:hover {
            background-color: #ce5050;
            border-radius: 8px;
            color: #FFFFFF; /* 修改文字颜色，可根据需要调整颜色值 */
        }

        .amis-scope .a-AsideNav-item.is-active > a:hover {
            background: #ce5050;
            border-radius: 8px;
            color: #FFFFFF; /* 修改文字颜色，可根据需要调整颜色值 */
        }

        .amis-scope .a-Layout-brand, .amis-scope .a-Layout-brandBar, .amis-scope .a-Layout-aside {
            background-color: #FFFFFF;
            box-shadow: #cfcfcf;

        }

        .amis-scope a {
            color: #ce5050; /* 修改文字颜色，可根据需要调整颜色值 */
        }

        .amis-scope .a-Switch.is-checked {
            background:  #ce5050;
        }

        .amis-scope .m-l-sm {
            color: #ce5050;
        }

        .amis-scope .a-AsideNav-subList {
            background: #FFFFFF;
            border-radius: 8px!important; /* 圆角矩形，可根据需要调整数值 */
        }

        .amis-scope .a-AsideNav-itemArrow svg {
            fill : #ce5050;
        }

        .amis-scope .a-AsideNav-itemArrow::after {
            color : #ce5050;
        }

        .amis-scope .a-AsideNav-itemArrow::before {
            color : #ce5050;
        }

        .amis-scope .a-AsideNav-itemArrow:empty {
            background-repeat: no-repeat;
            width: 0.625rem;
            height: 0.625rem;
            background-position: center center;
            display: inline-block;
            background: none !important; /* 移除原有背景 */
        }

        .amis-scope .a-AsideNav-item a:hover .a-AsideNav-itemArrow:empty:before {
            background: url("data:image/svg+xml,%3C%3Fxml version='1.0' encoding='UTF-8'%3F%3E%3Csvg viewBox='0 0 513 1021' version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'%3E%3Cg id='right-arrow' fill='%23ffffff' fill-rule='nonzero'%3E%3Cpath d='M56.559054,1013.77369 L512.908116,512.684524 L56.559054,12.234501 C49.4114678,2.93455912 37.6664238,-1.59188176 26.1262324,0.505948246 C14.586041,2.60377825 5.18544409,10.9741727 1.76815516,22.1946471 C-1.64913377,33.4151214 1.48980228,45.6045351 9.901516,53.778884 L424.706197,512.684524 L12.458094,969.672731 C2.45820596,982.551498 4.01297737,1000.9483 16.0324422,1011.96615 C28.0519071,1022.98399 46.5142346,1022.93619 58.476487,1011.85626 L56.559054,1013.77369 Z' id='è·¯å¾'%3E%3C/path%3E%3C/g%3E%3C/svg%3E%0A");
            background-repeat: no-repeat;
            width: 0.625rem;
            height: 0.625rem;
            background-position: center center;
            display: inline-block;
        }

        .amis-scope .a-AsideNav-itemArrow:empty:before {
            content: "";
            background: url("data:image/svg+xml,%3C%3Fxml version='1.0' encoding='UTF-8'%3F%3E%3Csvg viewBox='0 0 513 1021' version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'%3E%3Cg id='right-arrow' fill='%23ce5050' fill-rule='nonzero'%3E%3Cpath d='M56.559054,1013.77369 L512.908116,512.684524 L56.559054,12.234501 C49.4114678,2.93455912 37.6664238,-1.59188176 26.1262324,0.505948246 C14.586041,2.60377825 5.18544409,10.9741727 1.76815516,22.1946471 C-1.64913377,33.4151214 1.48980228,45.6045351 9.901516,53.778884 L424.706197,512.684524 L12.458094,969.672731 C2.45820596,982.551498 4.01297737,1000.9483 16.0324422,1011.96615 C28.0519071,1022.98399 46.5142346,1022.93619 58.476487,1011.85626 L56.559054,1013.77369 Z' id='è·¯å¾'%3E%3C/path%3E%3C/g%3E%3C/svg%3E%0A");
            background-repeat: no-repeat;
            width: 0.625rem;
            height: 0.625rem;
            background-position: center center;
            display: inline-block;
        }


        .amis-scope .a-AsideNav-item.is-open > a > .a-AsideNav-itemArrow:empty:before {
            background: url("data:image/svg+xml,%3C%3Fxml version='1.0' encoding='UTF-8'%3F%3E%3Csvg viewBox='0 0 513 1021' version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'%3E%3Cg id='right-arrow' fill='%23ffffff' fill-rule='nonzero'%3E%3Cpath d='M56.559054,1013.77369 L512.908116,512.684524 L56.559054,12.234501 C49.4114678,2.93455912 37.6664238,-1.59188176 26.1262324,0.505948246 C14.586041,2.60377825 5.18544409,10.9741727 1.76815516,22.1946471 C-1.64913377,33.4151214 1.48980228,45.6045351 9.901516,53.778884 L424.706197,512.684524 L12.458094,969.672731 C2.45820596,982.551498 4.01297737,1000.9483 16.0324422,1011.96615 C28.0519071,1022.98399 46.5142346,1022.93619 58.476487,1011.85626 L56.559054,1013.77369 Z' id='è·¯å¾'%3E%3C/path%3E%3C/g%3E%3C/svg%3E%0A");
            background-repeat: no-repeat;
            width: 0.625rem;
            height: 0.625rem;
            background-position: center center;
            display: inline-block;
        }

        /*
        .amis-scope .a-Panel {
            margin: 1.5rem 1.5rem 1.5rem 1.5rem;
        }
        */

        .amis-scope .a-Property > table {
            border-radius: 10px;
            overflow: hidden;
        }

        .amis-scope .a-Layout--asideFixed .a-Layout-aside {
            width: 15%;
            border: 1px solid #ce5050;
        }


        @media (max-width: 800px) {
            .amis-scope .a-Layout--asideFixed .a-Layout-aside {
                width: 25%;
            }
        }

        @media (max-width: 576px) {
            .amis-scope .a-Layout--asideFixed .a-Layout-aside {
                width: 80%;
            }
        }

        @media (max-width: 576px) {
            .a-Flex {
                flex-direction: column !important;
            }
        }

        @media (max-width: 576px) {
            .amis-scope .p-2 {
                position: relative;
                top: 50px;
            }
        }


        .amis-scope .a-TextControl .InputText-clear {
            background-color: #ffffff;
        }



    </style>
</head>
<body>
<div class="app-wrapper" id="root"></div>
<script>
    (function () {
        let amis = amisRequire('amis/embed');
        const match = amisRequire('path-to-regexp').match;

        // 如果想用 browserHistory 请切换下这处代码, 其他不用变
        // const history = HistoryLibrary.createBrowserHistory();
        const history = HistoryLibrary.createHashHistory();
        const app = ${AmisSchemaJson};

        function normalizeLink(to, location = history.location) {
            to = to || '';

            if (to && to[0] === '#') {
                to = location.pathname + location.search + to;
            } else if (to && to[0] === '?') {
                to = location.pathname + to;
            }

            const idx = to.indexOf('?');
            const idx2 = to.indexOf('#');
            let pathname = ~idx ? to.substring(0, idx) : ~idx2 ? to.substring(0, idx2) : to;
            let search = ~idx ? to.substring(idx, ~idx2 ? idx2 : undefined) : '';
            let hash = ~idx2 ? to.substring(idx2) : location.hash;
            if (!pathname) {
                pathname = location.pathname;
            } else if (pathname[0] != '/' && !/^https?\:\/\//.test(pathname)) {
                let relativeBase = location.pathname;
                const paths = relativeBase.split('/');
                paths.pop();
                let m;
                while ((m = /^\.\.?\//.exec(pathname))) {
                    if (m[0] === '../') {
                        paths.pop();
                    }
                    pathname = pathname.substring(m[0].length);
                }
                pathname = paths.concat(pathname).join('/');
            }
            return pathname + search + hash;
        }

        function isCurrentUrl(to, ctx) {
            if (!to) {
                return false;
            }
            const pathname = history.location.pathname;
            const link = normalizeLink(to, {
                ...location,
                pathname,
                hash: ''
            });

            if (!~link.indexOf('http') && ~link.indexOf(':')) {
                let strict = ctx && ctx.strict;
                return match(link, {
                    decode: decodeURIComponent,
                    strict: typeof strict !== 'undefined' ? strict : true
                })(pathname);
            }

            return decodeURI(pathname) === link;
        }

        let amisInstance = amis.embed(
            '#root',
            app,
            {location: history.location, locale: "${locale}"},
            {
                // watchRouteChange: fn => {
                //   return history.listen(fn);
                // },
                updateLocation: (location, replace) => {
                    location = normalizeLink(location);
                    if (location === 'goBack') {
                        return history.goBack();
                    } else if (
                        (!/^https?\:\/\//.test(location) &&
                            location ===
                            history.location.pathname + history.location.search) ||
                        location === history.location.href
                    ) {
                        // 目标地址和当前地址一样，不处理，免得重复刷新
                        return;
                    } else if (/^https?\:\/\//.test(location) || !history) {
                        return (window.location.href = location);
                    }

                    history[replace ? 'replace' : 'push'](location);
                },
                jumpTo: (to, action) => {
                    if (to === 'goBack') {
                        return history.goBack();
                    }

                    to = normalizeLink(to);

                    if (isCurrentUrl(to)) {
                        return;
                    }

                    if (action && action.actionType === 'url') {
                        action.blank === false
                            ? (window.location.href = to)
                            : window.open(to, '_blank');
                        return;
                    } else if (action && action.blank) {
                        window.open(to, '_blank');
                        return;
                    }

                    if (/^https?:\/\//.test(to)) {
                        window.location.href = to;
                    } else if (
                        (!/^https?\:\/\//.test(to) &&
                            to === history.pathname + history.location.search) ||
                        to === history.location.href
                    ) {
                        // do nothing
                    } else if (location.hash && to.indexOf("?") > -1) {
                        //如果当前页面有hash，且跳转的页面有参数，将hash拼接到参数后面
                        const [hash, search] = to.split("?");
                        window.location.href = location.pathname + "?" + search + "#" + hash;
                    } else {
                        history.push(to);
                    }
                },
                isCurrentUrl: isCurrentUrl,
                theme: "${theme}"
            }
        );

        history.listen(state => {
            amisInstance.updateProps({
                location: state.location || state,
                locale: "${locale}"
            });
        });
    })();
</script>
</body>
</html>
